//
//  DataModle.h
//  LoanTeam15
//
//  Created by gynjobs on 2017/8/18.
//  Copyright © 2017年 cangming. All rights reserved.
//

#import "BaseCommondObject.h"

typedef enum{
    
    DATA_TYPE_TEXT = 1,
    DATA_TYPE_DATE,
    DATA_TYPE_CITY,
    DATA_TYPE_NUM,
    DATA_TYPE_TEL,
    DATA_TYPE_PHONE,
    DATA_TYPE_LIST,
    DATA_TYPE_IMAGE,
    DATA_TYPE_RADIO,
    DATA_TYPE_MONEY,
    DATA_TYPE_SMS,
    DATA_TYPE_UNIT
    
}ItemDataType;


@interface DataModle : BaseCommondObject{
    NSString * key;
    NSString * name;
    ItemDataType type;
    NSInteger required;
    NSString * tip1;
    NSString * tip2;
    NSString * tip3;
    NSInteger extend;
    SEL  validationHandler;
}

@property (nonatomic,strong) NSString * key ;
@property (nonatomic,strong) NSString * name;
@property (nonatomic,assign) ItemDataType type;
@property (nonatomic,assign) NSInteger required;
@property (nonatomic,strong) NSString * tip1;
@property (nonatomic,strong) NSString * tip2;
@property (nonatomic,strong) NSString * tip3;
@property (nonatomic,assign) NSInteger extend;
@property (nonatomic,assign) SEL validationHandler;

+(id)createWithKey:(NSString *) key;
+(id)createWithDic:(id) dic;
+(ItemDataType) getDataType:(id) dic;

-(BOOL)validateContent:(NSString *)content withKey:(NSString *) key ;

@end



@interface ItemListData : DataModle{
    
    NSString * datasource;
}

@property(nonatomic,strong) NSString * datasource;

@end

@interface ItemNumData:DataModle {
    
    NSInteger min;
    NSInteger max;
}
@property (nonatomic,assign) NSInteger min;
@property (nonatomic,assign) NSInteger max;

@end



@interface ItemDataFactory : NSObject

+(DataModle*)create:(NSString*)key;
+(DataModle*)createWithDic:(NSDictionary*)dic;

@end


